package com.lishuang.DAO;

import java.sql.*;
/**
 * @author LiShuang
 * @version 1.0.0
 * @date 2022/11/12 17:27
 */
public class SqlConnector {
    private Connection con = null;
    private static final String DRIVER = "com.mysql.cj.jdbc.Driver";
    private static final String USER = "root";
    private static final String URL = "jdbc:mysql://  124.221.112.4:3307/gateway";
    private static final String PASS = "123456";
    public SqlConnector()throws Exception{
        Class.forName(DRIVER);
        con = DriverManager.getConnection(URL,USER,PASS);
    }
    public Connection getConnection()throws Exception{
        return con;
    }
    public void close()throws Exception{
        if(con!=null){
            con.close();
        }
    }
}
